home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11524 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Invalid Indirection???
  5. Date: Sun, 24 Mar 96 21:43:32 GMT
  6. Organization: none
  7. Message-ID: <827703812snz@genesis.demon.co.uk>
  8. References: <4i7cck$t67@infa.central.susx.ac.uk> <4iah9k$r02@newshost.cyberramp.net> <danpop.826916016@rscernix> <4ips1j$fq0@airdmhor.gen.nz> <1996Mar22.132529.4258@ms.philips.nl>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <1996Mar22.132529.4258@ms.philips.nl>
  15.            Pvestjen@ms.philips.nl "Patrick Vestjens" writes:
  16.  
  17. >I've been following this discussion and in my opinion there is at least
  18. >one situation where spaces DO make a difference. If you leave out the
  19. >space after the / in the expression "a / *b" (a divided by the value
  20. >optained after dereferencing b) you get "a /*b" where the /* is
  21. >interpreted (at least by the GNU preprocessor) as the start of a
  22. >comment.
  23.  
  24. The problem only occurs when one token forms a prefix to (i.e. the
  25. initial segment of) another token. The compiler always matches the
  26. longest possible token. For example - is a prefix to -- so
  27. when the compiler sees
  28.  
  29.   a --b;
  30.  
  31. you get a syntax error because -- here is the decrement operator. However
  32.  
  33.   a - -b;
  34.  
  35. is fine because here you have 2 separate - tokens and this is equivalent to
  36.  
  37.   a - (-b);
  38.  
  39. Similarly:
  40.  
  41.   a---b;   is equilalent to    a-- -b;
  42.  
  43. >Note however that comments are not in the grammar (they are being taken
  44. >care of by the preprocessor) so this does not introduce an ambiguity in
  45. >the grammar.
  46.  
  47. The character sequence /* doesn't form part of any valid token, except in a
  48. string literal where its meaning as a comment delimiter is suppressed.
  49.  
  50. -- 
  51. -----------------------------------------
  52. Lawrence Kirby | fred@genesis.demon.co.uk
  53. Wilts, England | 70734.126@compuserve.com
  54. -----------------------------------------
  55.